package com.xyy.saas.payment.service.impl;

import com.xyy.saas.payment.dao.mapper.ApplyAccountModifyMapper;
import com.xyy.saas.payment.dao.model.ApplyAccountModify;
import com.xyy.saas.payment.service.ApplyAccountModifyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class ApplyAccountModifyServiceImpl implements ApplyAccountModifyService {
    @Resource
    private ApplyAccountModifyMapper applyAccountModifyMapper;

    /**
     * 插入
     *
     * @param record
     */
    @Override
    public boolean insertSelective(ApplyAccountModify record) {
        return applyAccountModifyMapper.insertSelective(record) > 0;
    }

    /**
     * 更新
     *
     * @param record
     */
    @Override
    public boolean updateStatusByPrimary(ApplyAccountModify record) {
        return applyAccountModifyMapper.updateStatusByPrimary(record) > 0;
    }

    /**
     * 根据商户ID查询最近一条记录
     *
     * @param accountId
     */
    @Override
    public ApplyAccountModify queryApplyInfoByAccountId(String accountId, String source) {
        return applyAccountModifyMapper.queryApplyInfoByAccountId(accountId, source);
    }

    /**
     * 根据商户ID查询所有申请记录
     *
     * @param accountId
     * @param source
     */
    @Override
    public List<ApplyAccountModify> queryApplyInfoListByAccountId(String accountId, String source) {
        return applyAccountModifyMapper.queryApplyInfoListByAccountId(accountId, source);
    }

    /**
     * 根据申请单号查询
     *
     * @param applyNo
     */
    @Override
    public ApplyAccountModify queryApplyInfoByApplyNo(String applyNo) {
        return applyAccountModifyMapper.queryApplyInfoByApplyNo(applyNo);
    }
}